package test.xpdl;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import com.cait.workflowserver.definition.processdefinition.ProccessCollection;
import com.cait.workflowserver.utils.text.TextDecoder;
import com.cait.workflowserver.xpdl.parses.WorkflowProcessesParser;
import com.cait.workflowserver.xpdl.parses.XpdlParseContext;

import junit.framework.TestCase;

public class testXpdl extends TestCase {

	//测试功能
	public testXpdl(String arg0) {
		super(arg0);
	}
	
	
	protected void setUp() throws Exception {
		super.setUp();
	}
	
	
	public final void testXpdlT()
	{
		SAXReader reader = new SAXReader();
		Document Innerdocument = null; 
		
		System.out.println(TextDecoder.trim(TextDecoder.trim("无","<#"),"#>"));
	
		try {
			Innerdocument = reader.read(new java.io.File("G:\\workflow.xml"));
		} catch (DocumentException e) {
			System.out.println("Load XML出错："+e.getMessage());
			return;
		}
	
		if (Innerdocument != null) {
			Element root = null;
			try {
				root = Innerdocument.getRootElement();
	
			} catch (Exception ex) {
				System.out.println("Load XML节点出错："+ex.getMessage());
				return;
	
			}
			
			@SuppressWarnings("unused") ProccessCollection proccessCollection = null;
			WorkflowProcessesParser parser = new WorkflowProcessesParser();
			
			proccessCollection = (ProccessCollection)parser.Parse(root,new XpdlParseContext());
			System.out.println(proccessCollection.size());
			return;
		}
	
	}
	

	protected void tearDown() throws Exception {
		super.tearDown();
	}
	
}
